// pages/my/my.js
Page({
  data: {
    tabCur: 0,
    scrollleft: 0,
    tablist:["笔记","收藏"],
    allnotelist:[
      {
        coverUrl:"/image/演唱会.jpg",
      title:"❤其实我觉得没必要炫耀我见过薛之谦❤",
      headUrl:"/image/我的头像.jpg",
      userName:"昕情(登船版)",
      likeNum:"26w",
      category:"0"
      },
      {
        coverUrl:"/image/笔记1.jpg",
      title:"❤其实我觉得没必要炫耀我见过迪丽热巴❤",
      headUrl:"/image/我的头像.jpg",
      userName:"昕情(登船版)",
      likeNum:"101.2w",
      category:"0"
      },
      {
        coverUrl:"/image/收藏1.png",
      title:"请偷了去恶心你朋友🐷🐷",
      headUrl:"/image/旅行头像6.jpg",
      userName:"旺旺",
      likeNum:"33",
      category:"1"
      },
    ]
  },
  tabSelect(e) {
    let categoryId = e.currentTarget.dataset.id;
    let list = this.data.allnotelist;
    let newNoteList=[];

      for(let index= 0; index < list.length; index++){
        if(list[index].category == categoryId){
          newNoteList.push(list[index])
        }
      }
    this.setData({
      TabCur: e.currentTarget.dataset.id,
      scrollLeft: (e.currentTarget.dataset.id-1)*60,
      notelist:newNoteList
    })
  },
  onLoad(options) {
    let list=this.data.allnotelist;
    let newList=[];
    for(let index = 0;index < list.length;index++){
      if(list[index].category == 0){
        newList.push(list[index])
      }
    }
    this.setData({
      notelist:newList
    })
  },
  toLogin(){
    wx.navigateTo({
      url: '/pages/login/login',
    })
  },
  onReady() {

  },
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})